﻿window.onload=function(){
	var vue = new Vue({
			el:"#box",
			data:{
				myData:[
						{name:"a",age:"20"},
						{name:"b",age:"14"},
						{name:"c",age:"22"}
					],
				username:"",
				age:"",
				curIndex:0
			},
			methods:{
				add:function(){
					if(this.username == ""){
						alert("请输入信息");
					}else{
						this.myData.push({name:this.username,age:this.age});
						this.username = "";
						this.age = "";
					}
				},
				deleteCur:function(n){
					if(n == -1){
						this.myData = [];	
					}else{
						this.myData.splice(n,1);
					}
				}
			}
	});
}
